// Init App
let myApp = new Framework7({
    modalTitle: 'Follow Finance',
    // Enable Material theme
    material: true,
});

// Expose Internal DOM library
let $$ = Dom7;

// Add main view
let mainView = myApp.addView('.view-main', {});


myApp.init = function () {
    this.pages.init();
    $$(document).on('ajaxStart', function (e) {
        if (e.detail.xhr.requestUrl.indexOf('autocomplete-languages.json') >= 0) {
            return;
        }
        myApp.showIndicator();
    });
    $$(document).on('ajaxComplete', function (e) {
        if (e.detail.xhr.requestUrl.indexOf('autocomplete-languages.json') >= 0) {
            // Don't show preloader for autocomplete demo requests
            return;
        }
        myApp.hideIndicator();
    });


    document.addEventListener("deviceready", onDeviceReady, false);

    function onDeviceReady() {
        document.addEventListener("menubutton", menuButton, false);

        $$('.exit-app').on('click', () => {
            navigator.app.exitApp();
        });
    }

    function menuButton() {
        $$('.open-panel').trigger('click')
    }

};


